﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using PublicClass;
using S.Breeding.Domain;
using S.Breeding.Read.Api.Application.Command.LambWeaningCommand;

namespace S.Breeding.Read.Api.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class LambWeaningController : ControllerBase
    {
        private readonly IMediator mediator;
        public LambWeaningController(IMediator mediator)
        {
            this.mediator = mediator;
        }

        /// <summary>
        /// 羔羊断奶显示
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<PageInfo<LambWeaning>> GetLambWeaning([FromQuery]LambWeaningListCommand request, CancellationToken cancellationToken)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 羔羊断奶反填
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<LambWeaning> EditLambWeaning([FromQuery]LambWeaningEditCommand request, CancellationToken cancellationToken)
        {
            return await mediator.Send(request);
        }
    }
}
